﻿@using ExcellOnServices.Models
@{
    Order order = ViewBag.Order as Order;
    decimal? total = 0;
    int countDate = order.EndDateTime.Subtract(order.BeginDateTime).Days;
}

<p>Dear @ViewBag.CompanyName,</p>
<p>Information of your order:</p>
<p>Begin Date: @order.BeginDateTime.ToString("dd/MM/yyyy")</p>
<p>End Date: @order.EndDateTime.ToString("dd/MM/yyyy")</p>

<h4 style="font-weight:bold">List products below are valid:</h4>
<div>
    <table border="1" style="border: 1px solid; width:600px; border-spacing:0px">
        <tr style="background-color:#0ff">
            <th>
                Name
            </th>
            <th>
                Category
            </th>
            <th>
                Service
            </th>
            <th>
                Service Price
            </th>
        </tr>
        @foreach (var item in order.OrderItems)
        {
            <tr>
                <td style="text-align: left">
                    @item.Product.Name
                </td>
                <td style="text-align: left">
                    @item.Product.Category.Name
                </td>
                <td style="text-align: left">
                    @item.Service.Name
                </td>
                <td style="text-align: right">
                    @String.Format("{0:C}", item.ServicePrice)
                    @Html.Hidden("total", total= (item.ServicePrice * countDate) + total)
                </td>
            </tr>
        }
        <tr>
            <td colspan="3" style="text-align: right; font-weight: bold">
                Total of money
            </td>
            <td id="TongTien" style="font-weight: bold; color: black; text-align:right">
                @String.Format("{0:C}", total)
            </td>
        </tr>
    </table>
</div>
<p>Please to pay before begin date of this order to activate.</p>

